package com.bicon.base.data.service.botu.impl;

import java.util.List;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.bicon.base.data.common.Constants;
import com.bicon.base.data.common.exception.BusinessException;
import com.bicon.base.data.mapper.botu.THUserDrugMapper;
import com.bicon.base.data.pojo.botu.THUserDrug;
import com.bicon.base.data.service.botu.THUserDrugService;

/**
 * <p>
 * 用户用药记录 服务实现类
 * </p>
 *
 * @author zhoutyianqi
 * @since 2018-07-25
 */
@Service("thuserDrugService")
public class THUserDrugServiceImpl extends ServiceImpl<THUserDrugMapper, THUserDrug> implements THUserDrugService {

	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Transactional(propagation=Propagation.SUPPORTS,readOnly=true,rollbackFor=BusinessException.class)
	@Override
	public List<THUserDrug> findTHUserDrugByUid(String uid) {
		try {
			return this.baseMapper.findTHUserDrugByUid(uid);
		}catch(Exception ex) {
			logger.error("系统错误,错误原因:{}",ExceptionUtils.getMessage(ex.getCause()));
			throw new BusinessException(Constants.ERROR_STATE, "系统错误,错误原因:"+ExceptionUtils.getMessage(ex.getCause()));
		}
		
	}

	

}
